import Vue from "vue";
import App from "./App.vue";
import store from "./store/index";
import RequestHttp from "./utlis/HttpRequest";
import filters from "./utlis/filters";
import uView from "uview-ui";
import Public from "./utlis/CustomFunction";
import api from "./api/index.js";
import ioh5 from "socket.io-client";
import io from '@hyoga/uni-socket.io';
import customComponents from "./utlis/automaticImportComponent.js";
import clipboard from "./utlis/clipboard.js"
import uniFunc from './utlis/uni.public.js';
import {APP} from './utlis/APP-PLUS.js';
import {Platform,isH5,isAppPlus} from './utlis/environment.js';

Vue.config.productionTip = false;
Vue.prototype.$store = store;
Vue.prototype.api = api;
Vue.prototype.uniFunc = uniFunc;
Vue.prototype.$bus = new Vue();

Vue.prototype.baseImgUrl = 'http://192.168.88.65';
Vue.prototype.baseHttpUrl = 'http://192.168.88.65:8978/';

Vue.prototype.Platform =Platform;
Vue.prototype.isH5 = isH5
Vue.prototype.isApp = isAppPlus
Vue.prototype.APPPLUS = APP; 
// console.log(RequestHttp.MusicRequest);
// console.log(Platform,isH5,isAppPlus);


// #ifdef H5
Vue.prototype.socket = ioh5("http://192.168.88.15:8888");
// for (let key in customComponents) {
//   Vue.component(key, customComponents[key]);
// }
// #endif

// 除了h5 平台 其他平台的都有一下代码
// #ifndef H5


// #endif

Vue.prototype.socket = io("http://192.168.88.15:8888", {
	transports: ['websocket', 'polling'],
	timeout: 5000,
})

uni.onThemeChange(function (res) {
    console.log(res.theme);
});


// uni.connectSocket({
//   url: 'http://192.168.88.15:8888'
// });
// uni.onSocketOpen(function (res) {
//   console.log('WebSocket连接已打开！');
// });
// uni.onSocketError(function (res) {
//   console.log('WebSocket连接打开失败，请检查！');
// });


import bilihaerder from "./pages/components/bilibili/haerder/index.vue";
import ALineOfaColumn from "./pages/components/bilibili/list/ALineOfaColumn.vue";
import biliSymmetry from "./pages/components/bilibili/list/list.vue";
import bililistLine from "./pages/components/bilibili/list/listLine.vue";
import biliSlide from "./pages/components/bilibili/list/slideList.vue";
import bottomNav from "./pages/components/bottomNav/bottomNav.vue";
import haderBack from "./pages/components/chat/haderBack.vue";
import popup from "./pages/components/popup/popup.vue";
import Gongge from "./pages/components/SecondaryPackaging/Gongge/Gongge.vue";
import UniSegmentedControl from "./pages/components/uni-segmented-control/uni-segmented-control.vue";
import waterFill from "./pages/components/xiaohuangya-waterFull.vue";
import loading from "./pages/components/loading/index.vue";
import getloading from "./pages/components/loading/getloading.vue";
import chatHader from "./pages/components/chat/hader.vue";
import corresponding from './pages/components/corresponding/index.vue'
import RichText from './pages/components/editor/editor.vue'
import uniListItem from './pages/components/uni-ui/uni-list-item/uni-list-item.vue'
import maramleeWaterfallsFlow from './pages/components/maramlee-waterfalls-flow/maramlee-waterfalls-flow.vue'

Vue.component("bilihaerder", bilihaerder);
Vue.component("ALineOfaColumn", ALineOfaColumn);
Vue.component("biliSymmetry", biliSymmetry);
Vue.component("bililistLine", bililistLine);
Vue.component("biliSlide", biliSlide);
Vue.component("bottomNav", bottomNav);
Vue.component("chatHader", chatHader);
Vue.component("haderBack", haderBack);
Vue.component("loading", loading);
Vue.component("getloading", getloading);
Vue.component("popup", popup);
Vue.component("Gongge", Gongge);
Vue.component("UniSegmentedControl", UniSegmentedControl);
Vue.component("waterFill", waterFill);
Vue.component("corresponding", corresponding);
Vue.component("RichText", RichText);
Vue.component("uni-list-item", uniListItem);
Vue.component("maramlee-waterfalls-flow", maramleeWaterfallsFlow);


Vue.prototype.http = RequestHttp.req;
Vue.prototype.MusicRequest = RequestHttp.MusicRequest;
Vue.prototype.httpFile = RequestHttp.reqFile;
Vue.prototype.getimg = RequestHttp.getimg;
Vue.prototype.Public = Public;


Vue.use(uView);
Vue.prototype.$alert = function(message, ops) {
	//#ifdef APP-PLUS
	ops = ops || {};
	ops.verticalAlign = "top";
	plus.nativeUI.toast(message, ops);
	//#endif
	//#ifndef APP-PLUS
	uni.showToast({
		title: message + "",
	});
	//#endif
};

for (let key in filters) {
	Vue.filter(key, filters[key]);
}

new Vue({
	store,
	render(r) {
		return r(App);
	},
}).$mount();
